package cn.codergege.demo.ocr

import com.asprise.ocr.Ocr
import java.awt.image.BufferedImage



class OcrUtils {
    fun recognize(image: BufferedImage): String {
        Ocr.setUp()
        val ocr = Ocr()
        ocr.startEngine("eng", Ocr.SPEED_SLOW)
        val result = ocr.recognize(image, com.asprise.ocr.Ocr.RECOGNIZE_TYPE_ALL, com.asprise.ocr.Ocr.OUTPUT_FORMAT_PLAINTEXT, 0, null)
        ocr.stopEngine()
        return result
    }
}